home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / mdishe / app.bas next >
BASIC Source File  |  1994-12-29  |  7KB  |  284 lines

  1. ' ********************************************************
  2. '        MDI Standard Application Shell
  3. ' ********************************************************
  4. '
  5. ' SUMMARY
  6. ' -------
  7. ' This file is part of an MDI application "skeleton"
  8. ' created by John Blessing of Leigh Business Enterprises Ltd.
  9. '
  10. ' FEATURES
  11. ' --------
  12. ' Selection of application database.
  13. ' Compact/Repair of database.
  14. ' 'Helptips' on toolbar items.
  15. ' Support for Help files.
  16. ' MDI child forms tiling etc.
  17. ' Error trapping.
  18. ' 'Nag' screen support for shareware authors.
  19. ' Support for 3D dialogs (switched off in design mode
  20. '   to prevent GPFs)
  21. '
  22. ' USE
  23. ' ---
  24. ' You need VB Pro to use this shell, although it could be
  25. ' modified to run under the standard edition.
  26. '
  27. ' You will need to set up some information in APP.BAS,
  28. ' particularly in SetAppInfo().  You will also need to add
  29. ' your own application specific code to this module.
  30. '
  31. ' DISTRIBUTION
  32. ' ------------
  33. ' This program is "FreeWare" and may be used and distributed
  34. ' as you wish.
  35. '
  36. ' It incorporates some ideas/code from other authors and these
  37. ' are acknowledged in the appropriate module.
  38. '
  39. ' We hope that you will find it useful.  If you wish to discuss it
  40. ' then please e-mail us on Compuserve 100444,623.
  41. '
  42. ' ADVERTISEMENT!
  43. ' --------------
  44. ' Are you looking for a helpdesk system? Or does your company
  45. ' want to track and monitor the progress of any work activity?
  46. ' We market a system which could be of interest to you.
  47. '
  48. ' PROGRESS is available for download from the Business section
  49. ' of the Windows Shareware forum on Compuserve
  50. ' (filename PRGRSS10.ZIP).  It's a large program, so in the
  51. ' same section you will also find the help files and
  52. ' documentation as  PRGSSDOC.ZIP which is quicker to download
  53. ' and will give you a good idea of the functionality of PROGRESS.
  54. '
  55. ' Dec 1994
  56. Option Explicit
  57.  
  58. '======================================================================
  59. 'Form/Module:
  60. '   App.bas
  61. '
  62. 'Procedure:
  63. '   bValidDbase
  64. '
  65. 'Modifications:
  66. '   25/12/94   JBL     Build
  67. '
  68. 'Description:
  69. '   Checks the specified application database and returns True/False
  70. '
  71. '======================================================================
  72. Function bValidDbase (sDbase As String) As Integer
  73.     
  74.     'General Error Handler
  75.     If Not bDesignMode() Then
  76.         On Error GoTo Error_bValidDbase
  77.     End If
  78.     
  79.     'check for existence
  80.     If Not bFileExists(sDbase) Then
  81.         MsgBox tGApp.sDbaseName & "cannot be found.", MB_OK Or MB_ICONEXCLAMATION
  82.         bValidDbase = False
  83.         Exit Function
  84.     End If
  85.  
  86.     'put your code here to validate the database as one for
  87.     'your application
  88.     '
  89.     'e.g. you might have a "system" table - one field of which holds
  90.     'the app name and the other the version number.
  91.     'Checking these would enable you to make sure that it
  92.     'is the correct database and that it is a compatible
  93.     'version.
  94.     '
  95.     'Default behaviour for testing purposes
  96.     bValidDbase = True
  97.  
  98.     Exit Function
  99.  
  100. Error_bValidDbase:
  101.     'call the generic error handler
  102.     GenErrorHandler "App.bas - bValidDbase()", Err, Error$
  103.  
  104.     Resume Exit_bValidDbase
  105.  
  106. Exit_bValidDbase:
  107.  
  108. End Function
  109.  
  110. '======================================================================
  111. 'Form/Module:
  112. '   App.bas
  113. '
  114. 'Procedure:
  115. '   CreateAppDbase
  116. '
  117. 'Parameters:
  118. '   sDbase  Name of database to create
  119. '
  120. 'Returns:
  121. '   None
  122. '
  123. 'Modifications:
  124. '   29/12/94   JBL     Build
  125. '
  126. 'Description:
  127. '   Creates your application's database
  128. '======================================================================
  129. '
  130. Sub CreateAppDbase (sDbase As String)
  131.     
  132.     'General Error Handler
  133.     If Not bDesignMode() Then
  134.         On Error GoTo Error_CreateAppDbase
  135.     End If
  136.  
  137.  
  138.     'put your code to create the database here
  139.     MsgBox "Put your own code here to create the application database."
  140.  
  141.  
  142.     Exit Sub
  143.  
  144. Error_CreateAppDbase:
  145.     'call the generic error handler
  146.     GenErrorHandler "App.bas - CreateAppDbase()", Err, Error$
  147.  
  148.     Resume Exit_CreateAppDbase
  149.  
  150. Exit_CreateAppDbase:
  151.     
  152.  
  153. End Sub
  154.  
  155. '======================================================================
  156. 'Form/Module:
  157. '   App.bas
  158. '
  159. 'Procedure:
  160. '   SetAppInfo
  161. '
  162. 'Parameters:
  163. '   None
  164. 'Returns:
  165. '   None
  166. '
  167. 'Modifications:
  168. '   28/12/94   JBL     Build
  169. '
  170. 'Description:
  171. '   Specify information about the application
  172. '======================================================================
  173. '
  174. Sub SetAppInfo ()
  175.     
  176.     'General Error Handler
  177.     If Not bDesignMode() Then
  178.         On Error GoTo Error_SetAppInfo
  179.     End If
  180.     
  181.     
  182.     'this is the name of your application
  183.     tGApp.sName = "Standard Application"
  184.     
  185.     'if you leave this as an empty string then the Help
  186.     'menu item on mdiMain will be made invisible.
  187.     'just enter the name of the help file - not the path.
  188.     'It is assumed that the help file will be in the
  189.     'same directory as the application.
  190.     tGApp.sHelpFile = "winhelp.hlp" 'set to winhelp.hlp for testing purposes
  191.     
  192.     'if you app has an ini file then put it's name here
  193.     'The ini file will be created in the user's private
  194.     'windows directory, so don't specify a path.
  195.     'This entry is required if you want to use the shareware
  196.     'nag screen below
  197.     tGApp.sIniFile = "stdapp.ini"
  198.     
  199.     'complete this if you want to trigger the shareware
  200.     'nag screen fUsage.frm
  201.     tGApp.bEvaluation = True        'default
  202.     
  203.     'this is the .wri file loaded by the
  204.     'Ordering Information option under the Help menu
  205.     tGApp.sOrderInfoFile = ""
  206.  
  207.     'complete this to log all errors in a session to a logfile
  208.     'which will be created in the user's private windows dir
  209.     tGApp.sErrorFile = "stdapp.err"
  210.     
  211.     'this is the version number of the application
  212.     tGApp.dVersion = 1.1
  213.     
  214.     'This is the number of buttons on your toolbar.
  215.     'You must have the same number of icons loaded into the
  216.     'PicClip control on the mdiMain form.
  217.     'Don't forget to set the tag property of each button so
  218.     'that the helptip is correct.
  219.     tGApp.iToolButtonCount = 4
  220.  
  221.     Exit Sub
  222.  
  223. Error_SetAppInfo:
  224.     'call the generic error handler
  225.     GenErrorHandler "App.bas - SetAppInfo()", Err, Error$
  226.  
  227.     Resume Exit_SetAppInfo
  228.  
  229. Exit_SetAppInfo:
  230.  
  231. End Sub
  232.  
  233. '======================================================================
  234. 'Form/Module:
  235. '   App.bas
  236. '
  237. 'Procedure:
  238. '   ToolbarAction
  239. '
  240. 'Parameters:
  241. '   iButtonIndex
  242. '
  243. 'Returns:
  244. '   None
  245. '
  246. 'Modifications:
  247. '   28/12/94   JBL     Build
  248. '
  249. 'Description:
  250. '   Specify action for each toolbar button
  251. '======================================================================
  252. '
  253. Sub ToolbarAction (iButtonIndex As Integer)
  254.     
  255.     'General Error Handler
  256.     If Not bDesignMode() Then
  257.         On Error GoTo Error_ToolbarAction
  258.     End If
  259.     
  260.     Select Case iButtonIndex
  261.     Case 0  'New
  262.         'same as File New
  263.         NewDbase
  264.     Case 1  'open
  265.         'same as File Open
  266.         OpenDbase
  267.     'add in the actions for the rest of your toolbar below
  268.     Case 2  'print
  269.     Case 3  'save
  270.     End Select
  271.  
  272.     Exit Sub
  273.  
  274. Error_ToolbarAction:
  275.     'call the generic error handler
  276.     GenErrorHandler "App.bas - ToolbarAction()", Err, Error$
  277.  
  278.     Resume Exit_ToolbarAction
  279.  
  280. Exit_ToolbarAction:
  281.     
  282. End Sub
  283.  
  284.